package com.onpositive.dataminer.test;

import com.onpositive.semantic.model.api.status.CodeAndMessage;
import com.onpositive.semantic.model.api.validation.IValidationContext;
import com.onpositive.semantic.model.api.validation.IValidator;

public class ClassNameValidator implements IValidator<String>{

	@Override
	public CodeAndMessage isValid(IValidationContext context, String value) {
		try{
			if (value!=null&&value.length()>0){
			Class.forName(value);
			}
		}catch (Exception e) {
			return CodeAndMessage.errorMessage("Valid class name is expected");
		}
		return CodeAndMessage.OK_MESSAGE;
	}

}
